import request from '@/utils/request.js'

/* 关注用户接口 */
export const getFollowings = (data) => {
  return request({
    method: 'POST',
    url: '/app/v1_0/user/followings',
    data
  })
}

/* 取消用户关注 */
export const unGetFollowings = (target) => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/followings/${target}`
  })
}

// 收藏文章  /app/v1_0/article/collections
export const addCollections = (data) => {
  return request({
    method: 'POST',
    url: '/app/v1_0/article/collections',
    data
  })
}

/* 取消文章收藏 */
export const deleteCollections = (target) => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/article/collections/${target}`
  })
}

/* 点赞 */
export const addLikings = (data) => {
  return request({
    method: 'POST',
    url: '/app/v1_0/article/likings',
    data
  })
}

/* 取消点赞 */
export const deleteLikings = (target) => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/article/likings/${target}`
  })
}

/* 获取评论或评论回复 */
export const getComments = (params) => {
  return request({
    method: 'GET',
    url: '/app/v1_0/comments',
    params
  })
}

// 对评论或评论回复点赞  /app/v1_0/comment/likings
export const addCommentLikings = (target) => {
  return request({
    method: 'POST',
    url: '/app/v1_0/comment/likings',
    data: {
      target
    }
  })
}

/// * 取消对评论或评论回复点赞 */  /app/v1_0/comment/likings/:target
export const deleteCommentLikings = (target) => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/comment/likings/${target}`
  })
}

// 添加评论或评论回复   /app/v1_0/comments
export const addComments = (data) => {
  return request({
    method: 'POST',
    url: '/app/v1_0/comments',
    data
  })
}
